package com.aloda.enums;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.EnumValue;

/**
 * App分类枚举
 */
public enum AppCategoryStatusEnum {

    BANNED(1,"禁用"),
    NORMAL(0,"正常")
    ;

    @EnumValue
    private  int code;

    private  String desc;

    AppCategoryStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static AppCategoryStatusEnum fromCode(int code) {
        for (AppCategoryStatusEnum status : AppCategoryStatusEnum.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的用户状态码: " + code);
    }
}
